<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <title>crawler</title>
    <script src="${request.contextPath}/statics/libs/jquery.min.js"></script>

</head>
<body>
<p>欢迎使用crawler爬虫工具</p>
查询的网站：<input type="text" id="inpt"  placeholder="有种你就填">
<input type="button" onclick="saveOrUpdate()" value="确定"/>
<script>
    $(function () {

    })
    var cont =0;
    var isok =true;
    var interval;
    var shuju =[10,11,17,18,20,21,45,46,47,70,71,76,77,78,110,112,
        113,115,116,117,118,119,120,121,122,123,124,125,126,
        127,128,129,130,131,132,133,134,135,136,138,139,
        179,180,181,182,183,184,185,186,187,190,192,193,195,
        196,198,199,202,204,205,207,212,214,217,219,230,436,
        437,438,439,440,441,442,444,445,446,447,449,450,451,452,453,454,455,
        456,457,458,459,460,462,463,474,475,476,477,607,901,918];
    function saveOrUpdate() {
        interval =setInterval('saveOrUpdatexun()', 1000); ;
    }
    function saveOrUpdatexun(){
        if(isok){
            if(cont<shuju.length){
                $.ajax({
                    type: "POST",
                    url:"/api/crawler/pinpai",
                    async: false,
                    cache: true,

                    data:{crawlurl:"http://baike.1kuang.com/baike-"+shuju[cont]+".html"},
                    success: function(r){
                        if(r.code == 0){
                            cont++;
                            isok =true;
                            console.log("asaaaaaaaaa+cont::"+cont+"       zhaugtissn:::::::"+shuju[cont]);
                        }else{
                            alert(r.msg);
                        }
                    },
                    beforeSend:function () {
                        isok=false;
                        console.log("开始发送：：：cont："+cont+"       zhaugtissn:::::::"+shuju[cont]);
                    }
                });
            }else{
                console.log("结束！！！！")
                clearInterval(interval);
            }
        }
    }

</script>
</body>
</html>